package com.opdar.athena.messages;

import com.opdar.athena.base.Message;

import java.nio.ByteBuffer;

/**
 * Created by shiju on 2017/6/28.
 */
public class HeartbeatMessage extends Message {

    private long time;

    public HeartbeatMessage(byte[] body) {
        if(body.length == 8){
            for (int i = 7; i >= 0; i--) {
                time |= (body[i] & 0xff) << (8 * (7 - i));
            }
        }
        System.out.println(time);
    }

    public long getTime() {
        return time;
    }

    @Override
    public String command() {
        return "Heartbeat";
    }
}
